/*
 * @Author: xujianwei
 * @Date: 2021-11-16 11:47:23
 * @LastEditors: xujianwei
 * @LastEditTime: 2021-11-16 11:52:17
 */

function binarySearch(value,arrray){
    let left = 0,right = array.length -1,middle 
    if(value < array[left] || value > array[right]) return null
    while(left <= right){
        let middle = parseInt((left + right) / 2);
        if (value < array[middle]) {
            right = middle - 1;
        } else {
            left = middle + 1;
        }
    }
    return [left,right]
}

export default binarySearch